package com.sinosoft.hydra.um.domain.permission;

import com.alibaba.fastjson.annotation.JSONField;
import org.apache.ibatis.annotations.One;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name="T_DOCUMENT")
public class TDocument implements Serializable {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.ID
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(name="ID")
    private String id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Column(name="DOC_NAME")
    private String docName;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_CODE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Column(name="DOC_CODE")
    private String docCode;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.ATTACHMENT
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Column(name="ATTACHMENT")
    private String attachment;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.ATTACHMENT_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Column(name="ATTACHMENT_NAME")
    private String attachmentName;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.CREATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @OneToOne
    @JoinColumn(name="CREATE_USER")
    private SysUserMember createUser;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.CREATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @Column(name="CREATE_TIME")
    @JSONField(format = "yyyy-MM-dd")
    private Date createTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.UPDATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @OneToOne
    @JoinColumn(name="UPDATE_USER")
    private SysUserMember updateUser;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.UPDATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @Column(name="UPDATE_TIME")
    @JSONField(format = "yyyy-MM-dd")
    private Date updateTime;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOWNLOAD_TIMES
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @Max(value=8, message="tdocument.downloadtimes.max.overflow")
    @Column(name="DOWNLOAD_TIMES")
    private Integer downloadTimes;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_STATUS
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Column(name="DOC_STATUS")
    private String docStatus;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_DESCRIPTION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    @Size(max=200, message="tdistributeresource.docDescription.max.overflow")
    @Column(name="DOC_DESCRIPTION")
    private String docDescription;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_KEYWORD
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @Size(max=200, message="tdocument.docKeyWord.max.overflow")
    @Column(name="DOC_KEYWORD")
    private String docKeyWord;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.MODULE_TYPE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @OneToOne
    @JoinColumn(name="MODULE_TYPE")
    @NotFound(action = NotFoundAction.IGNORE)
    private TDirectory moduleType;

    @Transient
    private TFileConvert fileConvert;

    public TFileConvert getFileConvert() {
        return fileConvert;
    }

    public void setFileConvert(TFileConvert fileConvert) {
        this.fileConvert = fileConvert;
    }

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.DOC_BELONG
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @OneToOne
    @JoinColumn(name="DOC_BELONG")
    private SysOrganization docBelong;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column T_DOCUMENT.VERSION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    @Column(name="VERSION")
    private Integer version;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table T_DOCUMENT
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    private static final long serialVersionUID = 1L;

    @Transient
    public String getVersionDescription(){
        String str = "";
        if (version != null){
            str = "V" + version;
        }
        return str;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.ID
     *
     * @return the value of T_DOCUMENT.ID
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getId() {
        return id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.ID
     *
     * @param id the value for T_DOCUMENT.ID
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_NAME
     *
     * @return the value of T_DOCUMENT.DOC_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getDocName() {
        return docName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_NAME
     *
     * @param docName the value for T_DOCUMENT.DOC_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocName(String docName) {
        this.docName = docName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_CODE
     *
     * @return the value of T_DOCUMENT.DOC_CODE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getDocCode() {
        return docCode;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_CODE
     *
     * @param docCode the value for T_DOCUMENT.DOC_CODE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocCode(String docCode) {
        this.docCode = docCode;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.ATTACHMENT
     *
     * @return the value of T_DOCUMENT.ATTACHMENT
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getAttachment() {
        return attachment;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.ATTACHMENT
     *
     * @param attachment the value for T_DOCUMENT.ATTACHMENT
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setAttachment(String attachment) {
        this.attachment = attachment;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.ATTACHMENT_NAME
     *
     * @return the value of T_DOCUMENT.ATTACHMENT_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getAttachmentName() {
        return attachmentName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.ATTACHMENT_NAME
     *
     * @param attachmentName the value for T_DOCUMENT.ATTACHMENT_NAME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setAttachmentName(String attachmentName) {
        this.attachmentName = attachmentName;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.CREATE_USER
     *
     * @return the value of T_DOCUMENT.CREATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public SysUserMember getCreateUser() {
        return createUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.CREATE_USER
     *
     * @param createUser the value for T_DOCUMENT.CREATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setCreateUser(SysUserMember createUser) {
        this.createUser = createUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.CREATE_TIME
     *
     * @return the value of T_DOCUMENT.CREATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.CREATE_TIME
     *
     * @param createTime the value for T_DOCUMENT.CREATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.UPDATE_USER
     *
     * @return the value of T_DOCUMENT.UPDATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public SysUserMember getUpdateUser() {
        return updateUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.UPDATE_USER
     *
     * @param updateUser the value for T_DOCUMENT.UPDATE_USER
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setUpdateUser(SysUserMember updateUser) {
        this.updateUser = updateUser;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.UPDATE_TIME
     *
     * @return the value of T_DOCUMENT.UPDATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.UPDATE_TIME
     *
     * @param updateTime the value for T_DOCUMENT.UPDATE_TIME
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOWNLOAD_TIMES
     *
     * @return the value of T_DOCUMENT.DOWNLOAD_TIMES
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public Integer getDownloadTimes() {
        return downloadTimes;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOWNLOAD_TIMES
     *
     * @param downloadTimes the value for T_DOCUMENT.DOWNLOAD_TIMES
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDownloadTimes(Integer downloadTimes) {
        this.downloadTimes = downloadTimes;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_STATUS
     *
     * @return the value of T_DOCUMENT.DOC_STATUS
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getDocStatus() {
        return docStatus;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_STATUS
     *
     * @param docStatus the value for T_DOCUMENT.DOC_STATUS
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocStatus(String docStatus) {
        this.docStatus = docStatus;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_DESCRIPTION
     *
     * @return the value of T_DOCUMENT.DOC_DESCRIPTION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getDocDescription() {
        return docDescription;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_DESCRIPTION
     *
     * @param docDescription the value for T_DOCUMENT.DOC_DESCRIPTION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocDescription(String docDescription) {
        this.docDescription = docDescription;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_KEYWORD
     *
     * @return the value of T_DOCUMENT.DOC_KEYWORD
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public String getDocKeyWord() { return docKeyWord; }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_KEYWORD
     *
     * @param docKeyWord the value for T_DOCUMENT.DOC_KEYWORD
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocKeyWord(String docKeyWord) { this.docKeyWord = docKeyWord; }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.MODULE_TYPE
     *
     * @return the value of T_DOCUMENT.MODULE_TYPE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public TDirectory getModuleType() {
        return moduleType;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.MODULE_TYPE
     *
     * @param moduleType the value for T_DOCUMENT.MODULE_TYPE
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setModuleType(TDirectory moduleType) {
        this.moduleType = moduleType;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.DOC_BELONG
     *
     * @return the value of T_DOCUMENT.DOC_BELONG
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public SysOrganization getDocBelong() { return docBelong; }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.DOC_BELONG
     *
     * @param docBelong the value for T_DOCUMENT.DOC_BELONG
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setDocBelong(SysOrganization docBelong) { this.docBelong = docBelong; }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column T_DOCUMENT.VERSION
     *
     * @return the value of T_DOCUMENT.VERSION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public Integer getVersion() { return version; }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column T_DOCUMENT.VERSION
     *
     * @param version the value for T_DOCUMENT.VERSION
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */
    public void setVersion(Integer version) { this.version = version; }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_DOCUMENT
     *
     * @mbggenerated Sat Oct 10 11:52:13 CST 2015
     */

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", docName=").append(docName);
        sb.append(", docCode=").append(docCode);
        sb.append(", attachment=").append(attachment);
        sb.append(", attachmentName=").append(attachmentName);
        sb.append(", createUser=").append(createUser);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", downloadTimes=").append(downloadTimes);
        sb.append(", docStatus=").append(docStatus);
        sb.append(", docDescription=").append(docDescription);
        sb.append(", moduleType=").append(moduleType);
        sb.append("]");
        return sb.toString();
    }
}